# -*- coding: utf-8 -*-
'''
@文件    :log.py
@说明    :
@时间    :2025/08/28 15:30:00
@作者    :浪晋
@版本    :1.0
'''

from pydantic import Field, BaseModel
from typing import Optional, Union, Any, List, Dict
from decimal import Decimal
from datetime import date, datetime
from app.schemas.base import BaseQuerySchema


class BaseSchema(BaseModel):
    request_id: str = Field(..., description="请求Id")
    summary: str = Field(..., description="接口说明")
    url: str = Field(..., description="请求地址")
    method: Union[str, None] = Field(None, description="请求类型")
    client_ip: Union[str, None] = Field(None, description="客户端IP")
    headers: Union[str, None] = Field(None, description="请求头")
    payload: Union[Union[List, Dict], None] = Field(None, description="请求参数")
    result: Union[Union[List, Dict], None] = Field(None, description="响应结果")
    status_code: Union[str, int,  None] = Field(None, description="响应码")
    process_time: Union[str, None] = Field(None, description="响应时间")
    error_log: Union[str, None] = Field(None, description="错误日志")


class QuerySchema(BaseQuerySchema):
    request_id: Optional[str] = Field(None, description="请求Id")
    summary: Optional[str] = Field(None, description="接口说明")
    url: Optional[str] = Field(None, description="请求地址")
    method: Optional[Union[str, None]] = Field(None, description="请求类型")
    client_ip: Optional[Union[str, None]] = Field(None, description="客户端IP")
    payload: Optional[Union[Union[List, Dict], None]] = Field(None, description="请求参数")
    result: Optional[Union[Union[List, Dict], None]] = Field(None, description="响应结果")
    status_code: Optional[Union[str, None]] = Field(None, description="响应码")
    process_time: Optional[Union[str, None]] = Field(None, description="响应时间")
    error_log: Optional[Union[str, None]] = Field(None, description="错误日志")


class CreateSchema(BaseSchema):
    ...

class UpdateSchema(BaseSchema):
    id: int = Field(..., description="主键Id", example="1")